<template>
  <div>
    <div class="banner" @click="handleGalleryClick">
      <div class="wrapper-img">
        <img class="banner-img" src="//img1.qunarzz.com/sight/p0/1609/80/8092254b7f5f016ea3.water.jpg_600x330_45017f19.jpg">
      </div>
      <div class="banner-info">
        <div class="banner-title">{{sightName}}</div>
        <div class="banner-num">
          <span class="iconfont banner-icon">&#xe67a;</span>2
        </div>
      </div>
    </div>
    <common-gallery v-show="hasGallery" @close="handleGalleryClose"></common-gallery>
  </div>
</template>

<script>
import CommonGallery from 'common/gallery/Gallery'

export default{
  name: 'DetailBanner',
  props: {
    sightName: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      hasGallery: false
    }
  },
  methods: {
    handleGalleryClick () {
      this.hasGallery = true
    },
    handleGalleryClose () {
      this.hasGallery = false
    }
  },
  components: {
    CommonGallery
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    position: relative
    .wrapper-img
      overflow: hidden
      width: 100%
      padding-bottom: 55%
      height: 0
      background-color: #eeeeee
      .banner-img
        width: 100%
    .banner-info
      position: absolute
      bottom: .36rem
      left: .2rem
      right: .2rem
      display: flex
      line-height: .46rem
      height: .46rem
      color: #ffffff
      .banner-title
        padding: 0 .2rem
        font-size: .32rem
        flex: 1
      .banner-num
        width: 1.2rem
        height: .46rem
        text-align: center
        line-height: .46rem
        background-color: rgba(0,0,0,.5);
        font-size: .24rem
        border-radius: .24rem
        color: #ffffff
        .banner-icon
          padding-top: .1rem
</style>
